Question 3a

#read the csv file
RevenuePercent <- read.csv('RevenuePercent.csv')

#scatterplot matrix, "oma" for give extra space for legend
pairs(RevenuePercent[,2:6], col = RevenuePercent$Year, oma=c(2,2,2,13))
#allows the legend and the graph shows in one figure
par(xpd=TRUE)
#add legend
legend("topright", legend = RevenuePercent[,1], fill = RevenuePercent$Year)

This is a good graph because it can display every attribute in one figure without losing details.Also, it is colored by year, which makes the graph easier to read

Question 3a

library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(GGally)
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
#set column 1 "year" as group, and make the parallel coordinates plot
b=ggparcoord(RevenuePercent, groupColumn = 1, showPoints = TRUE)

#show the plot
ggplotly(b)

The lower point in the year column the earlier year is. The range is 2010-2014 This is a good graph because each line shows data by year, easy to understand.

Question 3b

#build faceting plot
ggplot(RevenuePercent, aes(x = Year)) +
  geom_histogram(color = "white",
                 fill = "cornflowerblue") +
  facet_grid(Grants ~ Other) +
  labs(title = "Revenue Percent shows by year",
       x = "year", y = "value")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

This is a bad graph because it is much complex and hard to understand this graph.

Question 3b

library("ggcorrplot")
corr <- round(cor(RevenuePercent[,2:6]),1)
#build correlation plot
ggcorrplot(corr, p.mat = cor_pmat(RevenuePercent[,2:6]),
           hc.order = TRUE, type = "lower",
           color = c("#FC4E07", "white", "#00AFBB"),
           outline.col = "white", lab = TRUE)

This is a bad graph because not every dataset is suitable for this visualization technique.

Question 3c

Question 3c

Question 4 Chernoff faces

library(aplpack)

#load life cycle saving dataset
g <- datasets::LifeCycleSavings

faces(g)

## effect of variables:
##  modified item       Var    
##  "height of face   " "sr"   
##  "width of face    " "pop15"
##  "structure of face" "pop75"
##  "height of mouth  " "dpi"  
##  "width of mouth   " "ddpi" 
##  "smiling          " "sr"   
##  "height of eyes   " "pop15"
##  "width of eyes    " "pop75"
##  "height of hair   " "dpi"  
##  "width of hair   "  "ddpi" 
##  "style of hair   "  "sr"   
##  "height of nose  "  "pop15"
##  "width of nose   "  "pop75"
##  "width of ear    "  "dpi"  
##  "height of ear   "  "ddpi"

This graph used Chernoff faces technique. the picture below this message is a screenshot of Chernoff faces, it gives a better view quality

Question 4 star

stars(g)

This graph encode data as stars

Question 4 stick figure

Discuess

each of graph contain a numbers of data in their shapes, the position of these shape represent the data from the life cycle savings dataset.